<!--代理商列表-->
<template>
  <el-select v-model="agentList"
             multiple
             :collapse-tags="true"
             filterable
             clearable size="small"
             default-first-option
             @change="handleOptionClick"
             placeholder="--系统名称--">
    <el-option v-for="items in restaurants" :key="items.id" :label="items.name" :value="items.id">
    </el-option>
  </el-select>
</template>
<script>
  export default {
    props: {
      // 接收一个由父级组件传递过来的值
      agentids: Array,
      area: false
    },
    computed: {
      agentList: {
        get() {
          return this.agentids
        },
        set() {}
      },
      restaurants() {
        return this.area ? this.$store.state.agentListArea : this.$store.state.agentList
      }
    },
    methods: {
      handleOptionClick(val) {
        this.$emit('listenToChildEvent', val)
      }
    }
  }
</script>
